import axios from '@/utils/request';

/**
 * 一级分类
 * @param params 查询条件
 */
export async function list(params) {
 
  const res = await axios.get('/consume.ticket/index', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}






/**
 * 修改
 * @param data 机构信息
 */
export async function update(data) {
  const res = await axios.post('/consume.ticket/edit', data);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}


/**
 * 排序
 * @param params nid oid 两个排序的id
 */
 export async function sortChange(params) {
  const res = await axios.post('/consume.ticket/sortChange', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}




/**
 * 排序
 * @param params nid oid 两个排序的id
 */
 export async function modify(data) {
  const res = await axios.post('/consume.ticket/modify', data);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}




export async function ticketConsumer(params) {
 
  const res = await axios.get('/consume.ticket/ticketConsumer', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}




export async function removeticketConsumer(id) {
  const res = await axios.get('/consume.ticket/removeticketConsumer?id=' + id);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}


export async function orderList(params) {
 
  const res = await axios.get('/consume.ticket/orderList', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
